#pragma once

#include <stdio.h>



#define XTRACE printf


typedef unsigned uint;

#define SFREE(p)                    { free(p); (p) = 0; }
#define SDELETE(p)                  { delete (p); (p) = 0; }
#define SDELETE_ARRAY(p)            { delete[] (p); (p) = 0; }
#define SRELEASE(p)                 { if (p) { (p)->Release(); (p) = 0; } }
                 

#ifndef M_PI
#define M_PI                        3.14159265358979323846f            // math.h -bol
#endif


const char *ft(const char *format, ...);        // format text


//
// class CStdFile
//             

class CStdFile
{
public:
    CStdFile()                                              { f = 0; }
    ~CStdFile()                                             { Close(); }

    bool Open(const char *filename, const char *mode);
    void Close()                                            { if (f) { fclose(f); f = 0; } }

    operator FILE*() const                                  { return f; }

private:
    FILE *f;

private:
    CStdFile(const CStdFile &);                     // masolas tiltasa
    CStdFile& operator= (const CStdFile &);
};
